package com.xy.Improve;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/21 20:39
 * @description
 */
public  class Client {
    public static void main(String[] args) {
        Duck mallardDuck = new MallardDuck();
        System.out.println("----绿头鸭----");
        mallardDuck.display();
        mallardDuck.performQuack();
        mallardDuck.performFly();

        Duck redHeadDuck = new RedHeadDuck();
        System.out.println("----红头鸭----");
        redHeadDuck.display();
        redHeadDuck.performQuack();
        redHeadDuck.performFly();

        Duck rubberDuck = new RubberDuck();
        System.out.println("----玩具鸭----");
        rubberDuck.display();
        rubberDuck.performFly();
        rubberDuck.performQuack();
        System.out.println("玩具鸭添加发声");
        redHeadDuck.setQuackBehavior(new Quack());
        redHeadDuck.performQuack();
    }
}
